﻿/**
 *
 * @file Point.h
 * @brief 算例相关Python接口封装
 * @author fulipeng (fulipengqd@yeah.net)
 * @date 2024-10-17
 *
 */
#ifndef __PY_Point_H__
#define __PY_Point_H__

#include <QString>
#include <QObject>
#include "PythonInterfaceAPI.h"

namespace Interface 
{
    class FITKAbsGeoModelPoint;
}

/**
 * @brief   点数据封装类
 * @author  fulipeng (fulipengqd@yeah.net)
 * @date    2024-10-17
 */
class Point
{
public:
    /**
     * @brief   Construct a new Point object
     * @param   id            算例ID
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-17
     */
    Point(int id = 0);
    /**
     * @brief   Construct a new Point object
     * @param   PointD          算例对象指针
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-17
     */
    Point(Interface::FITKAbsGeoModelPoint* p);
    /**
     * @brief   Destroy the Point object
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-17
     */
    ~Point() = default;
    /**
     * @brief   获取算例ID
     * @return  int
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-17
     */
    int getPointID();
    /**
     * @brief   获取算例名称
     * @return  QString
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-17
     */
    QString getName() const;
    /**
     * @brief   重命名算例
     * @param   name 新名称
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    void reName(const QString &name);

    Point* getPoint(const QString & pName);

private:
    /**
     * @brief   算例数据指针
     * @author  fulipeng (fulipengqd@yeah.net)
     * @date    2024-10-17
     */
    Interface::FITKAbsGeoModelPoint* _point{};
};

/**
 * @brief  算例数据装饰器类
 * @author fulipeng (fulipengqd@yeah.net)
 * @date 2024-10-17
 */
class PythonInterfaceAPI PointWapper : public QObject
{
    Q_OBJECT
public slots:
    /**
     * @brief  create a new Point
     * @return Point*
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    Point* new_Point();
    /**
     * @brief delete a Point
     * @param[i]  c               算例对象指针
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    void delete_Point(Point* c);
    /**
     * @brief 设置当前算例
     * @param[i0]  PointName        算例名称
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    void static_Point_SetCurrentPoint(QString & PointName);
    /**
     * @brief 获取当前算例
     * @return Point*
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    Point* static_Point_GetCurrentPoint();
    /**
     * @brief 创建一个新算例
     * @param[i]  PointName        算例名称
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    void static_Point_CreatePoint(const QString& PointName);
    /*  获取一个算例
     * @param[i]  PointName        算例名称
     * @return Point*
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    Point* static_Point_GetPoint(const QString& PointName);
    /**
     * @brief 重命名一个算例
     * @param[i]  c               算例对象指针
     * @param[i]  name            新名称
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    void reName(Point* c, QString& name);
    /**
     * @brief 获取算例名称
     * @param[i]  C               算例对象指针
     * @return QString
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    QString getName(Point* C);

    Point* getPoint(Point* c, const QString& name);

private:
    /**
     * @brief 更新UI
     * @param[i]  Pointid          算例ID
     * @author fulipeng (fulipengqd@yeah.net)
     * @date 2024-10-17
     */
    void updateUI(int Pointid);
};



#endif
